Full source code website bán hàng thương mại điện tử gần giống shopee
468.844 lượt xem;
1 <?
2 if (isset($_POST['butSaveLoai'])) {
3 $active = $_POST['active'];
4 $chietkhau = $_POST['chietkhau'];
5 $tien = $_POST['tien'];
6 $name = $_POST['txtName'];
7 $pass = $_POST['txtPass'];
8 $thutu = $_POST['thutu'];
9 $thutu_cat = $_POST['thutu_cat'];
10 $level = $_POST['txtLevel'];
11 $parent = $_POST['txtParent'];
12 $noidung = $_POST['noidung'];
13 $date=date("d/m/Y");
14 $date1=date("d/m/Y", strtotime( '+365 days' ));
15
16 if ($name=="")
17 {
18 echo "<p align=center class='err'>Bạn chưa nhập tên user</p>";
19 }
20 else
21 {
22 if (!empty($_POST['oldid'])) {
23 $oldid = $_POST['oldid'];
24
25 $sql = "update user_shop set user='".$name."',active='".$active."',tien='".$tien."'+tien, pass='".$pass."', thutu='".$thutu."', thutu_cat='".$thutu_cat."', level_shop='".$level."', cat_mem='".$parent."', pay_time='".$date."', end_time='".$date1."' where id='".$oldid."'";
26
27 }
28
29 else
30 {
31 $sql = "";
32 }
33 if (mysql_query($sql,$con))
34 {
35 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
36 echo "<script>window.location='index.php?act=users&page=".$_REQUEST['page']."'</script>";
37 }
38 else echo "<p align=center class='err'>Không thể cập nhật</p>";
39 }
40 }
41 ?>
42
43 <?
44 if (isset($_GET['id'])) {
45 $oldid=$_GET['id'];
46 $sql = "select * from user_shop where id='".$oldid."'";
47 if ($result = mysql_query($sql,$con)) {
48 $row=mysql_fetch_array($result);
49 $name=$row['user'];
50 $thutu=$row['thutu'];
51 $pass=$row['pass'];
52 $level=$row['level'];
53 $parent=$row['cat_mem'];
54 }
55 }
56 ?>
57
58 <form method="post" name="FormLoaiSP" action="index.php">
59 <input type=hidden name="act" value="users_add">
60 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
61
62 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
63
64 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
65 <tr>
66 <td width="45%" align="center" class="title" height="20">Thêm mới / Cập nhật : USERS</td>
67 </tr>
68 <tr>
69 <td width="45%">
70 <table border="0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
71 <tr>
72 <td width="15%" class="smallfont">
73 <p align="right">Tên đăng nhập</td>
74 <td width="1%" class="smallfont">
75 <font color="#FF0000">*</font></td>
76 <td width="83%" class="smallfont">
77 <INPUT value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
78 </tr>
79 <tr>
80 <td width="15%" class="smallfont">
81 <p align="right">Mật khẩu</td>
82 <td width="1%" class="smallfont">
83 <font color="#FF0000">*</font></td>
84 <td width="83%" class="smallfont">
85 <INPUT value="<? echo $pass; ?>" TYPE="text" NAME="txtPass" CLASS=textbox size="34"></td>
86 </tr>
87 <tr>
88
89 <tr>
90 <td width="15%" class="smallfont">
91 <p align="right">Thuộc danh mục</td>
92 <td width="1%" class="smallfont">
93 </td>
94 <td width="83%" class="smallfont">
95 <select size="1" name="txtParent">
96 <?
97 echo "<option value='17'>[Danh mục gốc]</option>";
98 $cats=GetListCat(17);
99 foreach ($cats as $cat)
100 {
101 if ($cat[0]==$parent)
102 echo "<option value=".$cat[0]." selected>".$cat[1]."</option>";
103 else
104 echo "<option value=".$cat[0].">".$cat[1]."</option>";
105 }
106 ?>
107 </select>
108
109 </td>
110
111 </tr>
112 <tr>
113 <td width="15%" class="smallfont">
114 <p align="right">Thứ tự Shop vip Top</td>
115 <td width="1%" class="smallfont">
116 <font color="#FF0000">*</font></td>
117 <td width="83%" class="smallfont">
118 <INPUT value="<? echo $thutu; ?>" TYPE="text" NAME="thutu" CLASS=textbox size="34"></td>
119 </tr>
120 <tr>
121 <td width="15%" class="smallfont">
122 <p align="right">Thứ tự shop vip theo danh mục</td>
123 <td width="1%" class="smallfont">
124 <font color="#FF0000">*</font></td>
125 <td width="83%" class="smallfont">
126 <INPUT value="<? echo $row['thutu_cat']; ?>" TYPE="text" NAME="thutu_cat" CLASS=textbox size="34"></td>
127 </tr>
128
129 <tr>
130 <td width="15%" class="smallfont">
131 <p align="right">Loại shop</td>
132 <td width="1%" class="smallfont" align="center">
133 </td>
134
135 <td width="63%" class="smallfont">
136 <select name="txtLevel" >
137 <?if($row['level_shop']=='0')
138 {?>
139 <option value='0' selected>Shop Vip</option>
140 <option value='3'>Shop Free</option>
141 <?}else{?>
142 <option value='0'>Shop Vip</option>
143 <option value='3' selected>Shop Free</option>
144 <?}?>
145 </select>
146
147
148
149
150
151
152
153 </td>
154
155 </tr>
156 <tr>
157 <td width="15%" class="smallfont">
158 <p align="right">Trạng thái hoa hồng</td>
159 <td width="1%" class="smallfont" align="center">
160 </td>
161
162 <td width="83%" class="smallfont">
163 <select name="active" >
164 <?if($row['active']=='0')
165 {?>
166 <option value='0' selected>Off</option>
167 <option value='1'>On</option>
168 <?}else{?>
169 <option value='0'>Off</option>
170 <option value='1' selected>On</option>
171 <?}?>
172 </select>
173
174
175
176
177 </td>
178
179 </tr>
180
181 <!--tr>
182 <td width="15%" class="smallfont">
183 <p align="right">Thêm ngân sách</td>
184 <td width="1%" class="smallfont">
185 <font color="#FF0000"></font></td>
186 <td width="83%" class="smallfont">
187 <INPUT TYPE="text" NAME="tien" CLASS=textbox size="24"> Đang có: <?php echo $row['tien'];?> VNĐ </td>
188
189 </tr-->
190 <tr>
191 <td width="15%" class="smallfont">
192 <p align="right">
193 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button> </td>
194 <td width="1%" class="smallfont">
195 </td>
196 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
197 </tr>
198 </table>
199 </td>
200 </tr>
201 </table>
202 </form>
2 if (isset($_POST['butSaveLoai'])) {
3 $active = $_POST['active'];
4 $chietkhau = $_POST['chietkhau'];
5 $tien = $_POST['tien'];
6 $name = $_POST['txtName'];
7 $pass = $_POST['txtPass'];
8 $thutu = $_POST['thutu'];
9 $thutu_cat = $_POST['thutu_cat'];
10 $level = $_POST['txtLevel'];
11 $parent = $_POST['txtParent'];
12 $noidung = $_POST['noidung'];
13 $date=date("d/m/Y");
14 $date1=date("d/m/Y", strtotime( '+365 days' ));
15
16 if ($name=="")
17 {
18 echo "<p align=center class='err'>Bạn chưa nhập tên user</p>";
19 }
20 else
21 {
22 if (!empty($_POST['oldid'])) {
23 $oldid = $_POST['oldid'];
24
25 $sql = "update user_shop set user='".$name."',active='".$active."',tien='".$tien."'+tien, pass='".$pass."', thutu='".$thutu."', thutu_cat='".$thutu_cat."', level_shop='".$level."', cat_mem='".$parent."', pay_time='".$date."', end_time='".$date1."' where id='".$oldid."'";
26
27 }
28
29 else
30 {
31 $sql = "";
32 }
33 if (mysql_query($sql,$con))
34 {
35 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
36 echo "<script>window.location='index.php?act=users&page=".$_REQUEST['page']."'</script>";
37 }
38 else echo "<p align=center class='err'>Không thể cập nhật</p>";
39 }
40 }
41 ?>
42
43 <?
44 if (isset($_GET['id'])) {
45 $oldid=$_GET['id'];
46 $sql = "select * from user_shop where id='".$oldid."'";
47 if ($result = mysql_query($sql,$con)) {
48 $row=mysql_fetch_array($result);
49 $name=$row['user'];
50 $thutu=$row['thutu'];
51 $pass=$row['pass'];
52 $level=$row['level'];
53 $parent=$row['cat_mem'];
54 }
55 }
56 ?>
57
58 <form method="post" name="FormLoaiSP" action="index.php">
59 <input type=hidden name="act" value="users_add">
60 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
61
62 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
63
64 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
65 <tr>
66 <td width="45%" align="center" class="title" height="20">Thêm mới / Cập nhật : USERS</td>
67 </tr>
68 <tr>
69 <td width="45%">
70 <table border="0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
71 <tr>
72 <td width="15%" class="smallfont">
73 <p align="right">Tên đăng nhập</td>
74 <td width="1%" class="smallfont">
75 <font color="#FF0000">*</font></td>
76 <td width="83%" class="smallfont">
77 <INPUT value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
78 </tr>
79 <tr>
80 <td width="15%" class="smallfont">
81 <p align="right">Mật khẩu</td>
82 <td width="1%" class="smallfont">
83 <font color="#FF0000">*</font></td>
84 <td width="83%" class="smallfont">
85 <INPUT value="<? echo $pass; ?>" TYPE="text" NAME="txtPass" CLASS=textbox size="34"></td>
86 </tr>
87 <tr>
88
89 <tr>
90 <td width="15%" class="smallfont">
91 <p align="right">Thuộc danh mục</td>
92 <td width="1%" class="smallfont">
93 </td>
94 <td width="83%" class="smallfont">
95 <select size="1" name="txtParent">
96 <?
97 echo "<option value='17'>[Danh mục gốc]</option>";
98 $cats=GetListCat(17);
99 foreach ($cats as $cat)
100 {
101 if ($cat[0]==$parent)
102 echo "<option value=".$cat[0]." selected>".$cat[1]."</option>";
103 else
104 echo "<option value=".$cat[0].">".$cat[1]."</option>";
105 }
106 ?>
107 </select>
108
109 </td>
110
111 </tr>
112 <tr>
113 <td width="15%" class="smallfont">
114 <p align="right">Thứ tự Shop vip Top</td>
115 <td width="1%" class="smallfont">
116 <font color="#FF0000">*</font></td>
117 <td width="83%" class="smallfont">
118 <INPUT value="<? echo $thutu; ?>" TYPE="text" NAME="thutu" CLASS=textbox size="34"></td>
119 </tr>
120 <tr>
121 <td width="15%" class="smallfont">
122 <p align="right">Thứ tự shop vip theo danh mục</td>
123 <td width="1%" class="smallfont">
124 <font color="#FF0000">*</font></td>
125 <td width="83%" class="smallfont">
126 <INPUT value="<? echo $row['thutu_cat']; ?>" TYPE="text" NAME="thutu_cat" CLASS=textbox size="34"></td>
127 </tr>
128
129 <tr>
130 <td width="15%" class="smallfont">
131 <p align="right">Loại shop</td>
132 <td width="1%" class="smallfont" align="center">
133 </td>
134
135 <td width="63%" class="smallfont">
136 <select name="txtLevel" >
137 <?if($row['level_shop']=='0')
138 {?>
139 <option value='0' selected>Shop Vip</option>
140 <option value='3'>Shop Free</option>
141 <?}else{?>
142 <option value='0'>Shop Vip</option>
143 <option value='3' selected>Shop Free</option>
144 <?}?>
145 </select>
146
147
148
149
150
151
152
153 </td>
154
155 </tr>
156 <tr>
157 <td width="15%" class="smallfont">
158 <p align="right">Trạng thái hoa hồng</td>
159 <td width="1%" class="smallfont" align="center">
160 </td>
161
162 <td width="83%" class="smallfont">
163 <select name="active" >
164 <?if($row['active']=='0')
165 {?>
166 <option value='0' selected>Off</option>
167 <option value='1'>On</option>
168 <?}else{?>
169 <option value='0'>Off</option>
170 <option value='1' selected>On</option>
171 <?}?>
172 </select>
173
174
175
176
177 </td>
178
179 </tr>
180
181 <!--tr>
182 <td width="15%" class="smallfont">
183 <p align="right">Thêm ngân sách</td>
184 <td width="1%" class="smallfont">
185 <font color="#FF0000"></font></td>
186 <td width="83%" class="smallfont">
187 <INPUT TYPE="text" NAME="tien" CLASS=textbox size="24"> Đang có: <?php echo $row['tien'];?> VNĐ </td>
188
189 </tr-->
190 <tr>
191 <td width="15%" class="smallfont">
192 <p align="right">
193 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button> </td>
194 <td width="1%" class="smallfont">
195 </td>
196 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
197 </tr>
198 </table>
199 </td>
200 </tr>
201 </table>
202 </form>